from selenium import webdriver
import time
from selenium.webdriver.common.by import By

dr = webdriver.Chrome()
dr.get("file:///C:/Users/Administrator/Desktop/自动化测试网页/自动化测试网页/注册A.html")
dr.maximize_window()
time.sleep(2)
# 找到点击弹窗
dr.find_element(By.ID,"alerta").click()
time.sleep(2)
# 接受弹窗
e = dr.switch_to.alert
print(e.text)
e.accept()
time.sleep(2)
dr.quit()